package com.zhou.base.flowable7.test.web.listener;

import org.flowable.engine.ProcessEngines;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * @description:
 * @author xianfeng
 * @date 2024/1/5 13:54
 */
public class ProcessEnginesServletContextListener implements ServletContextListener {

    public void contextInitialized(ServletContextEvent servletContextEvent) {
        //这将在类路径上查找 flowable.cfg.xml 资源文件，并为给定配置创建 ProcessEngine
        ProcessEngines.init();
        /**
         ProcessEngines.getDefaultProcessEngine()
         or
         ProcessEngines.getProcessEngine("myName");
         */
    }

    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        ProcessEngines.destroy();
    }
}